﻿//********************************************************************************//
//创建日期：<创建日期，2016-09-18>
//创建作者：<孙雪婷，sunxueting@shanghai3h.com>
//功能说明：取水计划输入
//********************************************************************************//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BLL;
using BLL.Access;
using System.Data;
using Platform.Http;
using System.Text;
using Web.Class;
using System.Dynamic;

namespace Web.Pages.QuShui.DiXiaS.JiHuaGL.QuShuiJH
{
    public partial class QuShuiJHSR : BasePage
    {
        #region 属性

        /// <summary>
        /// 保存结果集
        /// </summary>
        private DataTable dtSource
        {
            get
            {
                return ViewState["dtSource"] as DataTable;
            }
            set
            {
                ViewState["dtSource"] = value;
            }
        }

        #endregion

        #region 变量
        /// <summary>
        /// 取水计划
        /// </summary>
        QS_JH_QUSHUIJH _QSJH = new QS_JH_QUSHUIJH();

        /// <summary>
        /// 年计划bll
        /// </summary>
        QS_JH_QUSHUIJHBLL _QSJHBLL = new QS_JH_QUSHUIJHBLL();

        /// <summary>
        /// 存储过程执行类
        /// </summary>
        SpHelper _SpHelper = new SpHelper();
        BLL.SqlHelper _SplHelper = new BLL.SqlHelper();

        /// <summary>
        /// 操作日志BLL
        /// </summary>
        SYS_LOGBLL _SYS_LOGBLL = new SYS_LOGBLL();

        /// <summary>
        /// 参数bll
        /// </summary>
        QS_CANSHUBBLL _CANSHUBLL = new QS_CANSHUBBLL();
        #endregion

        #region 事件

        /// <summary>
        /// 页面加载事件
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            //第一次页面加载
            if (!IsPostBack)
            {
                InitData();
            }
            LoadData();
        }

        /// <summary>
        /// 绑定空表头
        /// </summary>
        protected override void Render(HtmlTextWriter sender)
        {
            base.Render(sender);
        }

        /// <summary>
        /// 查询事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            LoadData();
        }

        /// <summary>
        /// 响应前台回调
        /// </summary>
        protected void ASPxCallback1_Callback(object source, DevExpress.Web.CallbackEventArgs e)
        {
            dynamic expandoObject = new ExpandoObject();
            int year = Convert.ToInt32(cmbNianF1.Value);
            int iRole = Convert.ToInt32(cmbRole.SelectedItem.Value);
            //string msg = "";
            if (e.Parameter == "setinfo")
            {
                int id = Convert.ToInt32(this.hdCollection.Get("ID"));
                if (id != -1)
                {
                    expandoObject.type = "setinfo";
                    DataTable dt_temp = _SplHelper.p_qsjh_jihua_DBS(1, 0, Convert.ToInt32(cmbRole.SelectedItem.Value), id, year).Tables[0];
                    //int qsjh = Convert.ToInt32(dt_temp.Rows[0]["I_QUSHUIJH"]) / 10000;
                    // msg = string.Join("|", Convert.ToString(dt_temp.Rows[0]["S_YONGHUH"]), Convert.ToString(dt_temp.Rows[0]["S_YONGHUM"]), Convert.ToString(qsjh));
                    if (dt_temp.Rows.Count > 0)
                    {
                        expandoObject.ShenQingLY = dt_temp.Rows[0]["ShenQingLY"].ToString();
                        expandoObject.JianYiL = ToWang(dt_temp.Rows[0]["JianYiL"]);
                        expandoObject.JianYiLY = dt_temp.Rows[0]["JianYiLY"].ToString();
                        expandoObject.ShenHeL = ToWang(dt_temp.Rows[0]["ShenHeL"]);
                        expandoObject.ShenHeLY = dt_temp.Rows[0]["ShenHeLY"].ToString();
                        expandoObject.ShenPiL = ToWang(dt_temp.Rows[0]["ShenPiL"]);
                        expandoObject.ShenPiLY = dt_temp.Rows[0]["ShenPiLY"].ToString();

                        expandoObject.QSL   = ToWang(dt_temp.Rows[0]["QSL"]);
                        expandoObject.QSL1  = ToWang(dt_temp.Rows[0]["QSL1"]);
                        expandoObject.QSL2  = ToWang(dt_temp.Rows[0]["QSL2"]);
                        expandoObject.QSL3  = ToWang(dt_temp.Rows[0]["QSL3"]);
                        expandoObject.QSL4  = ToWang(dt_temp.Rows[0]["QSL4"]);
                        expandoObject.QSL5  = ToWang(dt_temp.Rows[0]["QSL5"]);
                        expandoObject.QSL6  = ToWang(dt_temp.Rows[0]["QSL6"]);
                        expandoObject.QSL7  = ToWang(dt_temp.Rows[0]["QSL7"]);
                        expandoObject.QSL8  = ToWang(dt_temp.Rows[0]["QSL8"]);
                        expandoObject.QSL9  = ToWang(dt_temp.Rows[0]["QSL9"]);
                        expandoObject.QSL10 = ToWang(dt_temp.Rows[0]["QSL10"]);
                        expandoObject.QSL11 = ToWang(dt_temp.Rows[0]["QSL11"]);
                        expandoObject.QSL12 = ToWang(dt_temp.Rows[0]["QSL12"]);

                        expandoObject.QuShuiJH = ToWang(dt_temp.Rows[0]["QuShuiJH"]);
                        expandoObject.YHSQLY1  = ToWang(dt_temp.Rows[0]["YHSQLY1"]);
                        expandoObject.YHSQLY2  = ToWang(dt_temp.Rows[0]["YHSQLY2"]);
                        expandoObject.YHSQLY3  = ToWang(dt_temp.Rows[0]["YHSQLY3"]);
                        expandoObject.YHSQLY4  = ToWang(dt_temp.Rows[0]["YHSQLY4"]);
                        expandoObject.YHSQLY5  = ToWang(dt_temp.Rows[0]["YHSQLY5"]);
                        expandoObject.YHSQLY6  = ToWang(dt_temp.Rows[0]["YHSQLY6"]);
                        expandoObject.YHSQLY7  = ToWang(dt_temp.Rows[0]["YHSQLY7"]);
                        expandoObject.YHSQLY8  = ToWang(dt_temp.Rows[0]["YHSQLY8"]);
                        expandoObject.YHSQLY9  = ToWang(dt_temp.Rows[0]["YHSQLY9"]);
                        expandoObject.YHSQLY10 = ToWang(dt_temp.Rows[0]["YHSQLY10"]);
                        expandoObject.YHSQLY11 = ToWang(dt_temp.Rows[0]["YHSQLY11"]);
                        expandoObject.YHSQLY12 = ToWang(dt_temp.Rows[0]["YHSQLY12"]);

                        expandoObject.YWYJYL1  = ToWang(dt_temp.Rows[0]["YWYJYL1"]);
                        expandoObject.YWYJYL2  = ToWang(dt_temp.Rows[0]["YWYJYL2"]);
                        expandoObject.YWYJYL3  = ToWang(dt_temp.Rows[0]["YWYJYL3"]);
                        expandoObject.YWYJYL4  = ToWang(dt_temp.Rows[0]["YWYJYL4"]);
                        expandoObject.YWYJYL5  = ToWang(dt_temp.Rows[0]["YWYJYL5"]);
                        expandoObject.YWYJYL6  = ToWang(dt_temp.Rows[0]["YWYJYL6"]);
                        expandoObject.YWYJYL7  = ToWang(dt_temp.Rows[0]["YWYJYL7"]);
                        expandoObject.YWYJYL8  = ToWang(dt_temp.Rows[0]["YWYJYL8"]);
                        expandoObject.YWYJYL9  = ToWang(dt_temp.Rows[0]["YWYJYL9"]);
                        expandoObject.YWYJYL10 = ToWang(dt_temp.Rows[0]["YWYJYL10"]);
                        expandoObject.YWYJYL11 = ToWang(dt_temp.Rows[0]["YWYJYL11"]);
                        expandoObject.YWYJYL12 = ToWang(dt_temp.Rows[0]["YWYJYL12"]);

                        expandoObject.KZSHL1  = ToWang(dt_temp.Rows[0]["KZSHL1"]);
                        expandoObject.KZSHL2  = ToWang(dt_temp.Rows[0]["KZSHL2"]);
                        expandoObject.KZSHL3  = ToWang(dt_temp.Rows[0]["KZSHL3"]);
                        expandoObject.KZSHL4  = ToWang(dt_temp.Rows[0]["KZSHL4"]);
                        expandoObject.KZSHL5  = ToWang(dt_temp.Rows[0]["KZSHL5"]);
                        expandoObject.KZSHL6  = ToWang(dt_temp.Rows[0]["KZSHL6"]);
                        expandoObject.KZSHL7  = ToWang(dt_temp.Rows[0]["KZSHL7"]);
                        expandoObject.KZSHL8  = ToWang(dt_temp.Rows[0]["KZSHL8"]);
                        expandoObject.KZSHL9  = ToWang(dt_temp.Rows[0]["KZSHL9"]);
                        expandoObject.KZSHL10 = ToWang(dt_temp.Rows[0]["KZSHL10"]);
                        expandoObject.KZSHL11 = ToWang(dt_temp.Rows[0]["KZSHL11"]);
                        expandoObject.KZSHL12 = ToWang(dt_temp.Rows[0]["KZSHL12"]);

                        expandoObject.CZSPL1  = ToWang(dt_temp.Rows[0]["CZSPL1"]);
                        expandoObject.CZSPL2  = ToWang(dt_temp.Rows[0]["CZSPL2"]);
                        expandoObject.CZSPL3  = ToWang(dt_temp.Rows[0]["CZSPL3"]);
                        expandoObject.CZSPL4  = ToWang(dt_temp.Rows[0]["CZSPL4"]);
                        expandoObject.CZSPL5  = ToWang(dt_temp.Rows[0]["CZSPL5"]);
                        expandoObject.CZSPL6  = ToWang(dt_temp.Rows[0]["CZSPL6"]);
                        expandoObject.CZSPL7  = ToWang(dt_temp.Rows[0]["CZSPL7"]);
                        expandoObject.CZSPL8  = ToWang(dt_temp.Rows[0]["CZSPL8"]);
                        expandoObject.CZSPL9  = ToWang(dt_temp.Rows[0]["CZSPL9"]);
                        expandoObject.CZSPL10 = ToWang(dt_temp.Rows[0]["CZSPL10"]);
                        expandoObject.CZSPL11 = ToWang(dt_temp.Rows[0]["CZSPL11"]);
                        expandoObject.CZSPL12 = ToWang(dt_temp.Rows[0]["CZSPL12"]);
                    }
                }
                // e.Result = e.Parameter + "|0|" + msg;
            }
            else if (e.Parameter == "save")
            {
                int id = Convert.ToInt32(this.hdCollection.Get("ID"));
                //OperateState operateState;
                ////添加
                //if (id == -1)
                //{
                //    this._QSJH.ID = 0;
                //    operateState = OperateState.Add;
                //}
                ////修改
                //else
                //{
                //    //修改操作
                //    _QSJH = _QSJHBLL.SelectQS_JH_QUSHUIJH(id);
                //    operateState = OperateState.Modify;
                //}
                //int val = Convert.ToInt32(cmbShuRu.Value);//1 万立方米，2 立方米


                //_QSJH.I_QUSHUIJH = val == 1 ? (Convert.ToDecimal(txtQuShuiJH.Text) * 10000) : Convert.ToDecimal(txtQuShuiJH.Text);
                //_QSJH.I_JLZT = 0;
                //_QSJH.S_YONGHUH = txtBianHao.Text;
                //_QSJH.I_TYPE = 1;
                //_QSJH.I_Y = BusinessTool.GetSLYMorZWNY(1, 1) / 100;
                //_QSJH.S_CAOZUOR = LoginInfo.CurrentUser.UserID.ToString();
                //_QSJH.D_CAOZUORQ = BusinessTool.GetDataBaseDateTime();
                //_SYS_LOGBLL.Log<QS_JH_QUSHUIJH>(LoginInfo.CurrentUser, BusinessTool.WType.ToString(), "取水计划输入", operateState, _QSJH, null);
                //bool result = _QSJHBLL.InsertOrUpdate(_QSJH);
                //if (result)
                //{
                //    msg = "true";

                //    e.Result = e.Parameter + "|0|" + msg;
                //}
                if (id != -1)
                {
                    expandoObject.type = "save";
                    expandoObject.role = iRole;
                    int[] sl = new int[13];
                    string ly = "";
                    if (iRole == 100027)
                    {
                        ToLiFang(txtQuShuiJH1.Text,  out sl[1]);
                        ToLiFang(txtQuShuiJH2.Text,  out sl[2]);
                        ToLiFang(txtQuShuiJH3.Text,  out sl[3]);
                        ToLiFang(txtQuShuiJH4.Text,  out sl[4]);
                        ToLiFang(txtQuShuiJH5.Text,  out sl[5]);
                        ToLiFang(txtQuShuiJH6.Text,  out sl[6]);
                        ToLiFang(txtQuShuiJH7.Text,  out sl[7]);
                        ToLiFang(txtQuShuiJH8.Text,  out sl[8]);
                        ToLiFang(txtQuShuiJH9.Text,  out sl[9]);
                        ToLiFang(txtQuShuiJH10.Text, out sl[10]);
                        ToLiFang(txtQuShuiJH11.Text, out sl[11]);
                        ToLiFang(txtQuShuiJH12.Text, out sl[12]);
                        ly = txtShenQingLY.Text;
                    }
                    else if (iRole == 100023)
                    {
                        ToLiFang(txtJianYiL1.Text,  out sl[1]);
                        ToLiFang(txtJianYiL2.Text,  out sl[2]);
                        ToLiFang(txtJianYiL3.Text,  out sl[3]);
                        ToLiFang(txtJianYiL4.Text,  out sl[4]);
                        ToLiFang(txtJianYiL5.Text,  out sl[5]);
                        ToLiFang(txtJianYiL6.Text,  out sl[6]);
                        ToLiFang(txtJianYiL7.Text,  out sl[7]);
                        ToLiFang(txtJianYiL8.Text,  out sl[8]);
                        ToLiFang(txtJianYiL9.Text,  out sl[9]);
                        ToLiFang(txtJianYiL10.Text, out sl[10]);
                        ToLiFang(txtJianYiL11.Text, out sl[11]);
                        ToLiFang(txtJianYiL12.Text, out sl[12]);
                        ly = txtJianYiLY.Text;
                    }
                    else if (iRole == 100000)
                    {
                        ToLiFang(txtShenHeL1.Text,  out sl[1]);
                        ToLiFang(txtShenHeL2.Text,  out sl[2]);
                        ToLiFang(txtShenHeL3.Text,  out sl[3]);
                        ToLiFang(txtShenHeL4.Text,  out sl[4]);
                        ToLiFang(txtShenHeL5.Text,  out sl[5]);
                        ToLiFang(txtShenHeL6.Text,  out sl[6]);
                        ToLiFang(txtShenHeL7.Text,  out sl[7]);
                        ToLiFang(txtShenHeL8.Text,  out sl[8]);
                        ToLiFang(txtShenHeL9.Text,  out sl[9]);
                        ToLiFang(txtShenHeL10.Text, out sl[10]);
                        ToLiFang(txtShenHeL11.Text, out sl[11]);
                        ToLiFang(txtShenHeL12.Text, out sl[12]);
                        ly = txtShenHeLY.Text;
                    }
                    else if (iRole == 1001)
                    {
                        ToLiFang(txtShenPiL1.Text,  out sl[1]);
                        ToLiFang(txtShenPiL2.Text,  out sl[2]);
                        ToLiFang(txtShenPiL3.Text,  out sl[3]);
                        ToLiFang(txtShenPiL4.Text,  out sl[4]);
                        ToLiFang(txtShenPiL5.Text,  out sl[5]);
                        ToLiFang(txtShenPiL6.Text,  out sl[6]);
                        ToLiFang(txtShenPiL7.Text,  out sl[7]);
                        ToLiFang(txtShenPiL8.Text,  out sl[8]);
                        ToLiFang(txtShenPiL9.Text,  out sl[9]);
                        ToLiFang(txtShenPiL10.Text, out sl[10]);
                        ToLiFang(txtShenPiL11.Text, out sl[11]);
                        ToLiFang(txtShenPiL12.Text, out sl[12]);
                        ly = txtShenPiLY.Text;
                    }
                    int V_Err = 0;
                    string V_Msg = "";
                    string sID = this.hdCollection.Get("ID").ToString();
                    _SplHelper.p_qsjh_jihuasr_dbs(sID, year, iRole, 
                        sl[1], sl[2], sl[3], sl[4], sl[5], sl[6],
                        sl[7], sl[8], sl[9], sl[10], sl[11], sl[12],
                        ly, out V_Err, out V_Msg);
                    expandoObject.success = V_Err == 0;
                    expandoObject.msg = V_Msg;
                }
            }
            else if (e.Parameter == "saveBatch")
            {
                expandoObject.type = "save";
                expandoObject.role = iRole;
                int V_Err = 0;
                string V_Msg = "";
                _SplHelper.p_qsjh_jihuasr_dbs("", year, iRole, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", out V_Err, out V_Msg);
                expandoObject.success = V_Err == 0;
                expandoObject.msg = V_Msg;
            }
            e.Result = Newtonsoft.Json.JsonConvert.SerializeObject(expandoObject);
        }

        /// <summary>
        /// 客户端刷新list
        /// </summary>
        protected void gvList_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
        {
            LoadData();
        }

        protected void gvList_CustomColumnDisplayText(object sender, DevExpress.Web.ASPxGridViewColumnDisplayTextEventArgs e)
        {
            if (e.Column.Caption == "序号")
                e.DisplayText = (e.VisibleRowIndex + 1).ToString();
            if (e.Column.FieldName == "QSL" || e.Column.FieldName == "YHSQL" || e.Column.FieldName == "YWYJYL" || e.Column.FieldName == "KZSHL" || e.Column.FieldName == "CZSPL")
                e.DisplayText = ToWang(e.Value);
        }

        #endregion

        #region 方法

        /// <summary>
        /// 初始化数据
        /// </summary>
        private void InitData()
        {
            // 年份
            int year = DateTime.Now.Year;
            for (int i = year - 10; i <= year; i++)
            {
                cmbNianF1.Items.Add(i.ToString(), i);
            }
            cmbNianF1.SelectedIndex = 10;
            // 角色
            cmbRole.Items.Clear();
            Action<int, string, string> FAddRole = delegate (int roleid, string roleList, string sRole)
            {
                DataSet ds = BLL.BusinessTool.GetTextAndValue("View_AS_UserInfo", "ROLENAME", "ROLEID", null,
                    "userid=" + LoginInfo.CurrentUser.UserID + " and roleid in (99999, " + roleList + ")");
                if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    cmbRole.Items.Add(sRole, roleid);
            };
            FAddRole(100027, "100027", "内勤登记");
            FAddRole(100023, "100023", "业务员建议");
            FAddRole(100000, "100000, 100026", "科长审核");
            FAddRole(1001, "1001, 1002", "处长审批");
            cmbRole.SelectedIndex = 0;
            cmbRole.ClientVisible = cmbRole.Items.Count > 1;
        }

        /// <summary>
        /// 数据加载
        /// </summary>
        private void LoadData()
        {
            int year = Convert.ToInt32(cmbNianF1.Value);
            int iRole = Convert.ToInt32(cmbRole.SelectedItem.Value);
            btnBatch.Visible = iRole != 100027;
            int iWorkT = Convert.ToInt32(rblWorktype.SelectedItem.Value);
            // 内勤
            if (iRole == 100027)
            {
                this.dtSource = _SplHelper.p_qsjh_jihua_DBS(0, iWorkT, 100027, 0, year).Tables[0];
                gvList.DataSource = this.dtSource;
                gvList.DataBind();
            }
            gvList.Visible = iRole == 100027;
            txtQuShuiJH1.ReadOnly = txtQuShuiJH2.ReadOnly = txtQuShuiJH3.ReadOnly = txtQuShuiJH4.ReadOnly
               = txtQuShuiJH5.ReadOnly = txtQuShuiJH6.ReadOnly = txtQuShuiJH7.ReadOnly = txtQuShuiJH8.ReadOnly
               = txtQuShuiJH9.ReadOnly = txtQuShuiJH10.ReadOnly = txtQuShuiJH11.ReadOnly = txtQuShuiJH12.ReadOnly
               = txtShenQingLY.ReadOnly = iRole != 100027;
            // 业务员
            if (iRole == 100023)
            {
                this.dtSource = _SplHelper.p_qsjh_jihua_DBS(0, iWorkT, 100023, 0, year).Tables[0];
                gvListYwy.DataSource = this.dtSource;
                gvListYwy.DataBind();
            }
            gvListYwy.Visible = iRole == 100023;
            txtJianYiL.ClientVisible = txtJianYiLY.ClientVisible = lblJianYiL.Visible = lblJianYiLY.Visible
                = txtJianYiL1.ClientVisible = txtJianYiL2.ClientVisible = txtJianYiL3.ClientVisible = txtJianYiL4.ClientVisible
                = txtJianYiL5.ClientVisible = txtJianYiL6.ClientVisible = txtJianYiL7.ClientVisible = txtJianYiL8.ClientVisible
                = txtJianYiL9.ClientVisible = txtJianYiL10.ClientVisible = txtJianYiL11.ClientVisible = txtJianYiL12.ClientVisible
                = (iRole == 100023 || iRole == 1001 || iRole == 100000);
            txtJianYiL1.ReadOnly = txtJianYiL2.ReadOnly = txtJianYiL3.ReadOnly = txtJianYiL4.ReadOnly
                = txtJianYiL5.ReadOnly = txtJianYiL6.ReadOnly = txtJianYiL7.ReadOnly = txtJianYiL8.ReadOnly
                = txtJianYiL9.ReadOnly = txtJianYiL10.ReadOnly = txtJianYiL11.ReadOnly = txtJianYiL12.ReadOnly
                = txtJianYiLY.ReadOnly = iRole != 100023;
            // 科长
            if (iRole == 100000)
            {
                this.dtSource = _SplHelper.p_qsjh_jihua_DBS(0, iWorkT, 100000, 0, year).Tables[0];
                gvListKZ.DataSource = this.dtSource;
                gvListKZ.DataBind();
            }
            gvListKZ.Visible = iRole == 100000;
            txtShenHeL.ClientVisible = txtShenHeLY.ClientVisible = lblShenHeL.Visible = lblShenHeYJ.Visible
                = txtShenHeL1.ClientVisible = txtShenHeL2.ClientVisible = txtShenHeL3.ClientVisible = txtShenHeL4.ClientVisible
                = txtShenHeL5.ClientVisible = txtShenHeL6.ClientVisible = txtShenHeL7.ClientVisible = txtShenHeL8.ClientVisible
                = txtShenHeL9.ClientVisible = txtShenHeL10.ClientVisible = txtShenHeL11.ClientVisible = txtShenHeL12.ClientVisible
                = (iRole == 1001 || iRole == 100000);
            txtShenHeL1.ReadOnly = txtShenHeL2.ReadOnly = txtShenHeL3.ReadOnly = txtShenHeL4.ReadOnly
                = txtShenHeL5.ReadOnly = txtShenHeL6.ReadOnly = txtShenHeL7.ReadOnly = txtShenHeL8.ReadOnly
                = txtShenHeL9.ReadOnly = txtShenHeL10.ReadOnly = txtShenHeL11.ReadOnly = txtShenHeL12.ReadOnly
                = txtShenHeLY.ReadOnly = iRole != 100000;
            // 处长
            if (iRole == 1001)
            {
                this.dtSource = _SplHelper.p_qsjh_jihua_DBS(0, iWorkT, 1001, 0, year).Tables[0];
                gvListCZ.DataSource = this.dtSource;
                gvListCZ.DataBind();
            }
            gvListCZ.Visible = txtShenPiL.ClientVisible = txtShenPiLY.ClientVisible = lblShenPiL.Visible = lblShenPiYJ.Visible
                = txtShenPiL1.ClientVisible = txtShenPiL2.ClientVisible = txtShenPiL3.ClientVisible = txtShenPiL4.ClientVisible
                = txtShenPiL5.ClientVisible = txtShenPiL6.ClientVisible = txtShenPiL7.ClientVisible = txtShenPiL8.ClientVisible
                = txtShenPiL9.ClientVisible = txtShenPiL10.ClientVisible = txtShenPiL11.ClientVisible = txtShenPiL12.ClientVisible
                = iRole == 1001;

            //int qushui = 0;
            //for (int i = 0; i < this.dtSource.Rows.Count; i++)
            //{
            //    qushui += Convert.ToInt32(this.dtSource.Rows[i]["I_QUSHUIJH"]);
            //}
            //lbQuShui.Text = "取水计划合计" + qushui.ToString() + "立方米";
            lbcount.Text = "共" + this.dtSource.Rows.Count.ToString() + "条";
        }

        private string ToWang(object val)
        {
            decimal dVal = DBNull.Value == val ? 0 : Convert.ToDecimal(val);
            dVal /= 10000;
            return dVal.ToString();
        }
        private void ToLiFang(string sVal, out int iVal)
        {
            decimal dVal = Convert.ToDecimal(sVal);
            dVal *= 10000;
            iVal = (int)dVal;
        }

        #endregion
    }
}